@extends('layout.app')
@section('content')
    <ul class="nav nav-tabs">
        <li class="active"><a href="#home" data-toggle="tab">信息</a></li>
        <li><a href="#profile" data-toggle="tab">密码</a></li>
    </ul>

    <div class="row">
        <div class="col-md-4">
            <br>
            @if(Session::has('message'))
                <li class="list-group-item list-group-item-success">{{Session::get('message')}}</li>
            @endif
            @if($errors->any())
                <ul class="list-group">
                    @foreach($errors->all() as $error)
                        <li class="list-group-item list-group-item-danger">{{$error}}</li>
                    @endforeach
                </ul>
            @endif
            <br>

                {!! Form::model($user,['method'=>'PATCH','id'=>'tab','url'=>'admin/'.$modelurl.'/'.$user->id]) !!}

            <div id="myTabContent" class="tab-content">
                <div class="tab-pane active in" id="home">


                    <div class="form-group">
                        {!! Form::label('name','用户名:') !!}
                        {!! Form::text('name',null,['class'=>'form-control']) !!}
                    </div>

                    <div class="form-group">
                        {!! Form::label('email','邮箱:') !!}
                        {!! Form::text('email',null,['class'=>'form-control']) !!}
                    </div>

                    <div class="form-group">
                        {!! Form::label('tele','联系电话:') !!}
                        {!! Form::text('tele',null,['class'=>'form-control']) !!}
                    </div>

                    <div class="form-group">
                        {!! Form::label('truename','真实姓名:') !!}
                        {!! Form::text('truename',null,['class'=>'form-control']) !!}
                    </div>

                    <div class="form-group">
                        {!! Form::label('grade','备注:') !!}
                        {!! Form::text('grade',null,['class'=>'form-control']) !!}
                    </div>
                    <script type="text/javascript">
                        $(function() {
                            $(".js-example-basic-multiple").select2({
                                placeholder: "添加角色"
                            });
                            $(".js-example-basic-multiple").val([@foreach($roles_list as $row)
                            '{{$row}}',
                                    @if($loop->last)
                                    '{{$row}}'
                                    @break
                                    @endif
                            @endforeach]).trigger('change')



                        });    </script>
                    <div class="form-group">
                        {!! Form::label('roles_list','选择角色') !!}
                        {!! Form::select('roles_list[]',$roles,null,['class'=>'form-control js-example-basic-multiple','multiple'=>'multiple']) !!}
                    </div>




                </div>

                <div class="tab-pane fade" id="profile">


                    <div class="form-group">
                        {!! Form::label('password','密码') !!}
                        {!! Form::text('password',null,['class'=>'form-control']) !!}
                    </div>


                </div>

            </div>

            <div class="btn-toolbar list-toolbar">
                {!! Form::submit('更新',['class'=>'btn btn-primary ']) !!}
                <a href="/admin/{{$modelurl}}/" data-toggle="modal" class="btn btn-danger">返回</a>
            </div>
            {!! Form::close() !!}
        </div>
    </div>

    {{--<div class="modal small fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">--}}
    {{--<div class="modal-dialog">--}}
    {{--<div class="modal-content">--}}
    {{--<div class="modal-header">--}}
    {{--<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>--}}
    {{--<h3 id="myModalLabel">Delete Confirmation</h3>--}}
    {{--</div>--}}
    {{--<div class="modal-body">--}}

    {{--<p class="error-text"><i class="fa fa-warning modal-icon"></i>Are you sure you want to delete the user?</p>--}}
    {{--</div>--}}
    {{--<div class="modal-footer">--}}
    {{--<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Cancel</button>--}}
    {{--<button class="btn btn-danger" data-dismiss="modal">Delete</button>--}}
    {{--</div>--}}
    {{--</div>--}}
    {{--</div>--}}
    {{--</div>--}}

@stop
